package cn.clwxy.gdz.service;

import cn.clwxy.gdz.bo.AdminOrderPageBean;
import cn.clwxy.gdz.dao.AdminOrderDao;
import cn.clwxy.gdz.dao.AdminOrderDaoimp;

public class AdminOrdeServiceImp implements AdminOrderService {
	AdminOrderDao aod=new AdminOrderDaoimp() ;
	@Override
	public AdminOrderPageBean getOrderBean(Integer pageNo) {
		AdminOrderPageBean apb=new AdminOrderPageBean();
		int totalCount=aod.getTotalCount().intValue();
		int totalPage=totalCount%15==0?totalCount/15:totalCount/15+1;
		apb.setOrderList(aod.getOrders(pageNo));
		apb.setFirstPage(1);
		apb.setLastPage(totalPage);
		apb.setPrePage(pageNo-1<0?1:pageNo-1);
		apb.setNextPage(pageNo+1>totalPage?totalPage:pageNo+1);
		apb.setTotalCoun(totalCount);
		apb.setTotalPage(totalPage);
		
		return apb;
	}

	@Override
	public int deal(Integer id,Double price) {
		int	result=	aod.deal(id,price);
		return result;
	}
public static void main(String[] args) {
	AdminOrdeServiceImp ss=new AdminOrdeServiceImp();
	AdminOrderPageBean orderBean = ss.getOrderBean(2);
	System.out.println(orderBean);
}

@Override
public int delete(int id) {
	return aod.delete(id);
	
}
}
